home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 16 / AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso / pd / anwendungen / amicad / arexx_english / align.amicad < prev    next >
Text File  |  1998-08-09  |  1KB  |  58 lines

  1. /* $VER: Align.AmiCAD 1.01e (© R.Florac, 9 août 1998) */
  2.  
  3. options results
  4.  
  5. signal on error
  6. signal on syntax
  7.  
  8. 'ALIGNEMENT=SELECT("Alignment"+CHR(10)+"Top"+CHR(10)+"Bottom"+CHR(10)+"Left"+CHR(10)+"Right")'
  9. alignement=result
  10. select
  11.     when alignement=1 then ligne_base=50000
  12.     when alignement=2 then ligne_base=0
  13.     when alignement=3 then colonne_base=50000
  14.     when alignement=4 then colonne_base=0
  15.     otherwise exit
  16. end
  17.  
  18. objets=0
  19. 'FIRSTSEL'; i=result
  20. do while i>0
  21.     objets=objets+1
  22.     'LINE('i')'; ligne=result
  23.     'COL('i')'; colonne=result
  24.     select
  25.     when alignement = 1 then do
  26.         if ligne<ligne_base then ligne_base=ligne
  27.     end
  28.     when alignement = 2 then do
  29.         if ligne>ligne_base then ligne_base=ligne
  30.     end
  31.     when alignement = 3 then do
  32.         if colonne<colonne_base then colonne_base=colonne
  33.     end
  34.     otherwise do
  35.         if colonne>colonne_base then colonne_base=colonne
  36.     end
  37.     end
  38.     'NEXTSEL('i')'; i=result
  39. end
  40.  
  41. if objets<2 then do
  42.     'MESSAGE("Select two objects"+CHR(10)+"or more before"+CHR(10)+"calling this script")'
  43.     exit
  44. end
  45.  
  46. 'SAVEALL(-1):O=FIRSTSEL:WHILE(O,IF(ALIGNEMENT<3,MOVE(O,0,'ligne_base'-LINE(O)),MOVE(O,'colonne_base'-COL(O),0)):O=NEXTSEL(O))'
  47.  
  48. exit
  49.  
  50. syntax:
  51. erreur=RC
  52. 'MESSAGE("Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  53. exit
  54.  
  55. error:
  56. 'MESSAGE("Error in line 'SIGL'")'
  57. exit
  58.